import 'package:sow_app_core/sow_app_core.dart';

class ChapterModel {
  String? novelId;
  String? chapterId;
  String? catalogue;
  String title;
  String? content;
  double? progress;

  ChapterModel.fromJson(Map<String, dynamic> json)
      : novelId = json['bookId'],
        chapterId = json['id'],
        catalogue = json['indexNum'],
        title = json['indexName'],
        content = json['lastBookContent'];

  Map<String, dynamic> toJson() => {
        'bookId': novelId,
        'id': chapterId,
        'indexNum': catalogue,
        'indexName': title,
        'content': content
      };

  Chapter toEntity() => Chapter(
      chapterId: chapterId,
      novelId: novelId,
      catalogue: catalogue,
      title: title,
      content: content);
}
